version: '3.8'
services:
  gateway:
    build: gateway
    image: java-shareit-gateway
    container_name: shareit-gateway
    ports:
      - "8080:8080"
    depends_on:
      - server
    environment:
      - SHAREIT_SERVER_URL=http://server:9090

  server:
    build: server
    image: java-shareit-server
    container_name: shareit-server
    ports:
      - "8090:8090"
      - "9091:9091"
    depends_on:
      - db
    environment:
      - SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/shareit
      - SPRING_DATASOURCE_USERNAME=shareit
      - SPRING_DATASOURCE_PASSWORD=shareit

  db:
    image: postgres:16-alpine
    container_name: shareit-db
    ports:
      - "5440:5432"
    environment:
      - POSTGRES_PASSWORD=shareit
      - POSTGRES_USER=shareit
      - POSTGRES_DB=shareit